package com.zx.zxapiorder.feign;

import com.zx.zxapicommon.common.BaseResponse;
import com.zx.zxapicommon.model.to.GetAvailablePiecesTo;
import com.zx.zxapicommon.model.to.LeftNumUpdateTo;
import com.zx.zxapicommon.model.to.UserRequest;
import com.zx.zxapicommon.model.vo.LockChargingVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author 张旭
 * @version 1.0
 */
@FeignClient(value = "zxapi-backend", url = "http://117.72.8.188:8082/api/")
public interface UserFeignServices {


    @PostMapping(value = "/user/checkUserLogin")
    BaseResponse checkUserLogin();

    @PostMapping(value = "/user/checkLogin")
    BaseResponse checkLogin(@RequestParam("request") HttpServletRequest request, @RequestParam("response") HttpServletResponse response);

    /**
     * 获取当前接口的剩余库存
     *
     * @param getAvailablePiecesTo
     * @return
     */
    @PostMapping("/charging/getPresentAvailablePieces")
    BaseResponse getPresentAvailablePieces(@RequestBody GetAvailablePiecesTo getAvailablePiecesTo);

    /**
     * 远程获取接口信息
     *
     * @param getAvailablePiecesTo
     * @return
     */
    @PostMapping("/interfaceInfo/getOrderInterfaceInfo")
    BaseResponse getOrderInterfaceInfo(@RequestBody GetAvailablePiecesTo getAvailablePiecesTo);

    /**
     * 远程更新库存
     *
     * @param lockChargingVo
     * @return
     */
    @PostMapping("/charging/updateAvailablePieces")
    BaseResponse updateAvailablePieces(@RequestBody LockChargingVo lockChargingVo);

    /**
     * 远程解锁库存
     *
     * @param lockChargingVo
     * @return
     */
    @PostMapping("/charging/unlockAvailablePieces")
    BaseResponse unlockAvailablePieces(@RequestBody LockChargingVo lockChargingVo);

    /**
     * 更新用户剩余可调用次数
     *
     * @param leftNumUpdateTo
     * @return
     */
    @PostMapping("/userInterfaceInfo/updateUserLeftNum")
    BaseResponse updateUserLeftNum(@RequestBody LeftNumUpdateTo leftNumUpdateTo);
}
